home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / misc / wt4w30ne.zip / WINTRAN.MST / WINTRAN.MST
Text File  |  1994-12-15  |  24KB  |  820 lines

  1. '**************************************************************************
  2. '*                       MSSetup Word Translator for Windows
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG          '' Define for script development/debugging
  6.  
  7.  
  8. ''$DEFINE NORWEGIAN    '' Norwegian version of the setup script
  9. '$DEFINE ENGLISH     '' English version of the setup script
  10.  
  11.  
  12.  
  13. ''$DEFINE SERIAL_NUMBER  '' Confirm correct serial number during installation
  14.                                 '' used only in the commercial version of Setup
  15.                                 '' Do not use if sending to USA.
  16.  
  17.  
  18. ''$DEFINE COMMER_VER  '' Commercial version of the setup script
  19.  
  20.  
  21. ''$DEFINE DEMO_VER   '' Demo version of the setup script
  22.  
  23. '$DEFINE SHAREWARE_VER      '' Shareware version of the setup script
  24.  
  25.  
  26.  
  27.  
  28. '$DEFINE EXP_VER
  29.  
  30. ''$DEFINE NORMAL_VER
  31.  
  32.  
  33.  
  34. '$INCLUDE 'setupapi.inc'
  35. '$INCLUDE 'msdetect.inc'
  36.  
  37.  
  38. '' Replace following strings to translate Setup messages to your language
  39. Translator_Setup$  = "Word Translator for Windows v3.0 Setup"
  40.  
  41.  
  42. '$IFDEF ENGLISH
  43.     Setup_Message$     = "Setup Message"
  44.     invoice$                 = "Product & Ordering Information"
  45.     wordtran_name$         = "Word Translator 3.0"
  46.     '$IFDEF DEMO_VER
  47.         wordtran_name$         = "Word Translator 3.0 Demo version"
  48.     '$ENDIF
  49.  
  50.    '$IFDEF SHAREWARE_VER
  51.         wordtran_name$         = "Word Translator 3.0 shareware version"
  52.     '$ENDIF
  53.  
  54. '$ENDIF ''ENGLISH
  55.  
  56.  
  57. '$IFDEF NORWEGIAN
  58.     Setup_Message$    = "Setup Melding"
  59.     invoice$               = "Hvordan Bestille Word Translator"
  60.     wordtran_name$         = "Word Translator 3.0"
  61.     '$IFDEF DEMO_VER
  62.         wordtran_name$         = "Word Translator 3.0 Demo versjon"
  63.     '$ENDIF
  64. '$ENDIF ''NORWEGIAN
  65.  
  66.  
  67.  
  68. ''Dialog ID's
  69. CONST ASKQUIT      = 200
  70. CONST DESTPATH     = 300
  71. CONST EXITFAILURE  = 400
  72. CONST EXITQUIT     = 600
  73. CONST EXITSUCCESS  = 700
  74. CONST OPTIONS      = 800
  75. CONST APPHELP      = 900
  76. CONST CUSTINST     = 6200
  77. CONST TOOBIG       = 6300
  78. CONST BADPATH      = 6400
  79.  
  80. CONST EXTENDEDLIST_DICT  = 3900
  81. CONST EXTENDEDLIST_FONTS = 3901
  82. CONST MULTILISTDICT      = 5201
  83. CONST MULTILISTFONT      = 5202
  84. CONST CDGETNAMEORG       = 7500
  85. CONST CDBADNAME          = 7700
  86. CONST CDCONFIRMINFO      = 7300
  87. CONST CDALREADYUSED      = 7100
  88. CONST BADSERIAL            = 7900
  89. CONST MANYBADSERIALS     = 8000
  90. CONST NOMOREINST         = 8100
  91. CONST CORUPTSOURCES      = 8200
  92. CONST DEMOINTRO          = 8300
  93. CONST CDNOCHOICES        = 8400
  94. CONST SHAREINTRO         = 8500
  95.  
  96.  
  97. ''Bitmap ID
  98. CONST LOGO         = 1
  99.  
  100. ''File Types
  101. CONST APPFILES     = 1
  102. CONST DICTFILES    = 2
  103. CONST FONTFILES    = 3
  104.  
  105.  
  106. GLOBAL DEST$        ''Default destination directory.
  107. GLOBAL WINDRIVE$    ''Windows drive letter.
  108.  
  109. ''CustInst list symbol names
  110. GLOBAL APPNEEDS$    ''Option list costs per drive
  111. GLOBAL DICTNEEDS$
  112. GLOBAL FONTNEEDS$
  113. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  114. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  115.  
  116. ''Dialog list symbol names
  117. GLOBAL CHECKSTATES$
  118. GLOBAL STATUSTEXT$
  119. GLOBAL DRIVETEXT$
  120. GLOBAL ALLDICTLIST$  ''List of all keys from Dictionary section
  121. GLOBAL ALLFONTLIST$  ''List of all keys from Fonts section
  122. GLOBAL DICTLIST$     ''List selection from Dictionary EXTENDEDLIST_DICT dialog.
  123. GLOBAL FONTLIST$     ''List selection from Fonts EXTENDEDLIST_FONTS dialog.
  124. GLOBAL APPFILELIST$  ''List of all application files in the [AppFiles]
  125.                             ''section of wintran.inf
  126. GLOBAL SPECIALLIST$  ''List of special information such as AdditonThreshold
  127.                             ''and MainDictionaryPath
  128.  
  129.  
  130. DECLARE SUB AddOptFilesToCopyList (ftype%)
  131. DECLARE SUB RecalcOptFiles (ftype%)
  132. DECLARE SUB RecalcPath
  133. DECLARE SUB SetDriveStatus
  134. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  135. DECLARE FUNCTION EliminatePath (szFile$) AS STRING
  136. DECLARE FUNCTION FCreateFile LIB "mscuistf.dll" (szFileName$) AS INTEGER
  137. DECLARE FUNCTION FCheck LIB "mscuistf.dll" (szSourceDir$) AS INTEGER
  138. DECLARE FUNCTION FAddFontResource_HZ LIB "mscuistf.dll" (szFileName$, szFontName$) AS INTEGER
  139. DECLARE FUNCTION FGetRegInfo_HZ LIB "mscuistf.dll" (szFileName$, szSymbolNumInstall$, szSymbolRegN$, szSymbolName$, szSymbolOrg$, bChange% ) AS INTEGER
  140. DECLARE FUNCTION FSetRegInfo_HZ LIB "mscuistf.dll" (szFileName$, szName$, szOrg$) AS INTEGER
  141.  
  142.  
  143. INIT:
  144.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  145.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  146.  
  147.     SetBitmap CUIDLL$, LOGO
  148.     SetTitle  Translator_Setup$
  149.  
  150.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  151.     IF szInf$ = "" THEN
  152.         szInf$ = GetSymbolValue("STF_CWDDIR") + "WINTRAN.INF"
  153.     END IF
  154.     ReadInfFile szInf$
  155.  
  156.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  157.     DEST$ = WINDRIVE$ + ":\WINTRAN"
  158. ''    DEST$ = "D:\WINTRAN"
  159.  
  160.     ''CustInst list symbols
  161.     CHECKSTATES$ = "CheckItemsState"
  162.     STATUSTEXT$  = "StatusItemsText"
  163.     DRIVETEXT$   = "DriveStatusText"
  164.     ALLDICTLIST$ = "DictListItemsIn"
  165.     ALLFONTLIST$ = "FontListItemsIn"
  166.     DICTLIST$    = "DictListItemsOut"
  167.      FONTLIST$    = "FontListItemsOut"
  168.      APPFILELIST$ = "AppFilesListItems"
  169.      SPECIALLIST$ = "SpecialListItems"
  170.  
  171.     FOR i% = 1 TO 3 STEP 1
  172.         AddListItem CHECKSTATES$, "ON"   '' check all (App, Dictionaries, Fonts)
  173.      NEXT i%
  174.     FOR i% = 1 TO 3 STEP 1
  175.           AddListItem STATUSTEXT$, ""
  176.     NEXT i%
  177.     FOR i% = 1 TO 7 STEP 1
  178.         AddListItem DRIVETEXT$, ""
  179.     NEXT i%
  180.     ReplaceListItem DRIVETEXT$, 7, DEST$
  181.  
  182.     ''Disk cost list symbols
  183.     APPNEEDS$   = "AppNeeds"
  184.     DICTNEEDS$  = "Opt1Needs"
  185.     FONTNEEDS$  = "Opt2Needs"
  186.     EXTRACOSTS$ = "ExtraCosts"
  187.     BIGLIST$    = "BigList"
  188.     FOR i% = 1 TO 3 STEP 1
  189.         AddListItem BIGLIST$, ""
  190.     NEXT i%
  191.     FOR i% = 1 TO 26 STEP 1
  192.         AddListItem EXTRACOSTS$, "0"
  193.     NEXT i%
  194.  
  195.     ''File Option Lists
  196.     MakeListFromSectionKeys ALLDICTLIST$, "Dictionaries"
  197.     MakeListFromSectionKeys ALLFONTLIST$, "Fonts"
  198.     MakeListFromSectionKeys DICTLIST$, "Dictionaries"
  199.      MakeListFromSectionKeys FONTLIST$, "Fonts"
  200.      MakeListFromSectionKeys APPFILELIST$, "AppFiles"
  201.      MakeListFromSectionKeys SPECIALLIST$, "Special"
  202.  
  203.     RecalcPath
  204.     SetDriveStatus
  205.  
  206. '$IFDEF DEBUG
  207.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  208. '$ENDIF ''DEBUG
  209.  
  210. '$IFDEF DEMO_VER
  211.      sz$ = UIStartDlg(CUIDLL$, DEMOINTRO, "FInfoDlgProc", APPHELP, HELPPROC$)
  212. '$ENDIF ''DEMO_VER
  213.  
  214. '$IFDEF SHAREWARE_VER
  215.      sz$ = UIStartDlg(CUIDLL$, SHAREINTRO, "FInfoDlgProc", APPHELP, HELPPROC$)
  216. '$ENDIF ''SHAREWARE_VER
  217.  
  218.  
  219.      numcustinst% = 0
  220.  
  221. CUSTINST:
  222.  
  223.      
  224.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  225.  
  226.     IF sz$ = "CONTINUE" THEN
  227.         ''Install only if it will fit.
  228.         ''FOR i% = 1 TO 3 STEP 1
  229.         ''    IF GetListItem(BIGLIST$, i%) <> "" THEN
  230.         ''        GOSUB TOOBIG
  231.         ''        GOTO CUSTINST
  232.           ''    END IF
  233.         ''NEXT i%
  234.         UIPop 1
  235.         GOTO INSTALL
  236.     ELSEIF sz$ = "PATH" THEN
  237.         GOTO GETPATH
  238.     ELSEIF sz$ = "CHK1" THEN
  239.         RecalcOptFiles APPFILES
  240.         SetDriveStatus
  241.         GOTO CUSTINST
  242.     ELSEIF sz$ = "CHK2" THEN
  243.         RecalcOptFiles DICTFILES
  244.         SetDriveStatus
  245.         GOTO CUSTINST
  246.     ELSEIF sz$ = "CHK3" THEN
  247.         RecalcOptFiles FONTFILES
  248.         SetDriveStatus
  249.         GOTO CUSTINST
  250.     ELSEIF sz$ = "BTN2" THEN
  251.         GOTO DICTFILES
  252.     ELSEIF sz$ = "BTN3" THEN
  253.         GOTO FONTFILES
  254.     ELSEIF sz$ = "REACTIVATE" THEN
  255.         RecalcPath
  256.         SetDriveStatus
  257.         GOTO CUSTINST
  258.     ELSE
  259.         GOSUB ASKQUIT
  260.         GOTO CUSTINST
  261.     END IF
  262.  
  263.  
  264.  
  265. INSTALL:
  266.  
  267.  
  268. '$IFDEF COMMER_VER
  269.  
  270.      ''$IFDEF EXP_VER
  271.           
  272.      ''      i% = FCheck(GetSymbolValue("STF_SRCDIR"))
  273.  
  274.     ''    IF i% = 0 THEN
  275.     ''            END
  276.      ''      END IF
  277.      ''$ENDIF
  278.  
  279.      REG$ = MakePath(GetSymbolValue("STF_SRCDIR"), "WT.INF")
  280.  
  281.      IF numcustinst% = 0 THEN
  282.          i% = FGetRegInfo_HZ(REG$, "NumInstallations", "SerialNumber", "Name", "Company", 1)
  283.      ELSE
  284.          i% = FGetRegInfo_HZ(REG$, "NumInstallations", "SerialNumber", "Name", "Company", 0)
  285.      END IF
  286.  
  287.     IF i% = 0 THEN
  288.         END
  289.      END IF
  290.  
  291.      numcustinst% = numcustinst% + 1
  292.  
  293.      
  294.     
  295.      regname$ = GetSymbolValue("Name")
  296.      regorg$  = GetSymbolValue("Company")
  297.      numinstalls$  = GetSymbolValue("NumInstallations")
  298.      serialnum$    = GetSymbolValue("SerialNumber")
  299.          
  300.      IF numinstalls$ = "000" THEN
  301.         sz$ = UIStartDlg(CUIDLL$, NOMOREINST, "FInfo0DlgProc", 0, "")
  302.       END
  303.      END IF
  304.  
  305.      AddListItem "ConfirmTextIn", ""
  306.     AddListItem "ConfirmTextIn", ""
  307.      regist% = 0
  308.      retries% = 2
  309.     IF regname$="" AND regorg$="" THEN   ''unregistered, need to register
  310.           GRI:
  311.           sz$ = UIStartDlg(CUIDLL$, CDGETNAMEORG, "FNameOrgDlgProc", APPHELP, HELPPROC$)
  312.         IF sz$ = "CONTINUE" THEN
  313.                 regname$     = GetSymbolValue("NameOut")
  314.                 serialno$   = GetSymbolValue("SerialNo")
  315.  
  316.             IF regname$ = "" THEN
  317.                 sz$ = UIStartDlg(CUIDLL$, CDBADNAME, "FInfo0DlgProc", 0, "")
  318.                 GOTO GRI
  319.                 END IF
  320.  
  321.  
  322.           '$IFDEF SERIAL_NUMBER
  323.                               
  324.                 IF serialnum$ <> serialno$ THEN
  325.                      sz$ = UIStartDlg(CUIDLL$, BADSERIAL, "FInfo0DlgProc", 0, "")
  326.                      IF retries% > 0 THEN
  327.                          retries% = retries% - 1    
  328.                          GOTO GRI
  329.                      ELSE
  330.                          sz$ = UIStartDlg(CUIDLL$, MANYBADSERIALS, "FInfo0DlgProc", 0, "")
  331.                          END
  332.                      END IF
  333.                 END IF
  334.  
  335.         '$ENDIF
  336.  
  337.             regorg$  = GetSymbolValue("OrgOut")
  338.             ReplaceListItem "ConfirmTextIn", 1, regname$
  339.             ReplaceListItem "ConfirmTextIn", 2, regorg$
  340.             sz$ = UIStartDlg(CUIDLL$, CDCONFIRMINFO, "FConfirmDlgProc", APPHELP, HELPPROC$)
  341.                 IF sz$ = "BACK" THEN
  342.                      retries% = 2
  343.                 GOTO GRI
  344.             END IF
  345.                 i% = FSetRegInfo_HZ(REG$, regname$, regorg$)
  346.                 IF i% = 0 THEN
  347.                     END
  348.                 END IF
  349.             regist% = 1
  350.         ELSEIF sz$ = "EXIT" THEN
  351.             GOSUB ASKQUIT
  352.                 GOTO GRI
  353.         ENDIF
  354.     ELSE
  355.           inf$ = MakePath(DEST$, "WT.INF")
  356.         IF EXISTS(inf$) THEN
  357.                 i% = FGetRegInfo_HZ(REG$, NULL, NULL, "Name", "Company",0)
  358.             IF i% = 0 THEN
  359.                END
  360.             END IF
  361.             reginame$ = GetSymbolValue("Name")
  362.             regiorg$  = GetSymbolValue("Company")
  363.             IF regname$ <> reginame$ OR regorg$ <> regiorg$ THEN
  364.                 GOTO WARNR
  365.             ENDIF
  366.         ELSE
  367.             WARNR:
  368.             ReplaceListItem "ConfirmTextIn", 1, regname$
  369.             ReplaceListItem "ConfirmTextIn", 2, regorg$
  370.             sz$ = UIStartDlg(CUIDLL$, CDALREADYUSED, "FConfirmDlgProc", APPHELP, HELPPROC$)
  371.             IF sz$ = "EXIT" THEN
  372.                 GOSUB ASKQUIT
  373.             ENDIF
  374.         ENDIF
  375.      ENDIF
  376.  
  377.      UIPopAll  '' hide the two windows that got the name, co. and reg. no. info.
  378.                   '' and verified the name and co.
  379.  
  380.      '$IFDEF EXP_VER
  381.  
  382.        ini2$ = MakePath(MID$(DEST$,1,3),"STAMP.WTW")
  383.        i% = FCreateFile (ini2$)
  384.                 
  385.      '$ENDIF
  386.  
  387. '$ENDIF  ''COMMER_VER
  388.  
  389.  
  390.      ClearCopyList
  391.     AddOptFilesToCopyList APPFILES
  392.     AddOptFilesToCopyList DICTFILES
  393.     AddOptFilesToCopyList FONTFILES
  394.     CreateDir DEST$, cmoNone
  395.      CopyFilesInCopyList
  396.     
  397.      numinstopts% = 0
  398.  
  399.  
  400.      ''IF GetListItem(CHECKSTATES$, DICTFILES) = "ON" THEN
  401.  
  402.           '$IFDEF EXP_VER
  403.                   ini$ = MakePath(DEST$, "WT.INI")
  404.           '$ENDIF
  405.  
  406.           '$IFDEF NORMAL_VER
  407.                 ini$ = MakePath(GetWindowsDir, "WT.INI")
  408.           '$ENDIF
  409.  
  410.         CreateIniKeyValue ini$, "General", "CurrentMode", "WordTranslation" , cmoOverwrite
  411.           CreateIniKeyValue ini$, "General", "InteractWith", "WordForWindows" , cmoNone
  412.         CreateIniKeyValue ini$, "General", "WordTranslatorHotkey", "Control + Shift" , cmoNone
  413.         CreateIniKeyValue ini$, "General", "SetupHotkey", "Alt + F7" , cmoNone
  414.           CreateIniKeyValue ini$, "General", "AccentHotkey", "RightAlt" , cmoNone
  415.           CreateIniKeyValue ini$, "General", "CancelSpeed", "0" , cmoNone
  416.           CreateIniKeyValue ini$, "General", "HideSpeedBar", "0" , cmoNone
  417.  
  418.           RemoveIniSection ini$, "Dictionaries", cmoNone
  419.  
  420.           IF GetListLength(SPECIALLIST$) > 0  THEN
  421.               special$ = GetListItem(SPECIALLIST$,1)
  422.               IF special$ <> "" THEN
  423.                   CreateIniKeyValue ini$, "Dictionaries", "AdditionThreshold", special$ , cmoOverwrite
  424.               END IF
  425.           END IF
  426.  
  427.           IF GetListLength(SPECIALLIST$) > 1  THEN
  428.              special$ = GetListItem(SPECIALLIST$,2)
  429.              IF special$ <> "" THEN
  430.                  CreateIniKeyValue ini$, "Dictionaries", "PathToMainDictionaries", special$ , cmoOverwrite
  431.              END IF
  432.         END IF
  433.  
  434.         IF regist% = 1 THEN
  435.             i% = FSetRegInfo_HZ(MakePath(DEST$, "WT.INF"), regname$, regorg$)
  436.             IF i% = 0 THEN
  437.                     END
  438.                 END IF
  439.         END IF
  440.           ini$ = ""
  441.           numinstopts% = numinstopts% + 1
  442.      ''END IF
  443.     
  444.     ''IF GetListItem(CHECKSTATES$, FONTFILES) = "ON" THEN
  445.         n% = GetListLength(FONTLIST$)
  446.         FOR i% = 1 TO n% STEP 1
  447.                 f$ = GetSectionKeyFilename("Fonts", GetListItem(FONTLIST$, i%))
  448.                 r% = FAddFontResource_HZ(MakePath(DEST$, f$),GetListItem(FONTLIST$, i%))
  449.           NEXT i%
  450.           numinstopts% = numinstopts% + 1
  451.     ''END IF
  452.  
  453.  
  454.      ''IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  455.          IF GetListLength(APPFILELIST$) > 0  THEN
  456.              CreateProgmanGroup "Word Translator", "", cmoNone
  457.              ShowProgmanGroup  "Word Translator", 1, cmoNone
  458.              CreateProgmanItem "Word Translator", wordtran_name$, MakePath(DEST$,"wt.exe"), "", cmoOverwrite
  459.              CreateProgmanItem "Word Translator", "Word Translator Manual", "winhelp.exe "+MakePath(DEST$,"wt.hlp"), "", cmoOverwrite
  460.              CreateProgmanItem "Word Translator", invoice$, "write.exe "+MakePath(DEST$,"info.wri"), "", cmoOverwrite
  461.                          CreateProgmanItem "Word Translator", "Read Me", "notepad.exe "+MakePath(DEST$,"readme.txt"), "", cmoOverwrite 
  462.              if EXISTS(MakePath(DEST$, "CONVERT.EXE")) THEN
  463.                 CreateProgmanItem "Word Translator", "Text Converter", MakePath(DEST$,"convert.exe"), "", cmoOverwrite
  464.                END IF
  465.              numinstopts% = numinstopts% + 1
  466.          END IF
  467.      ''END IF
  468.    
  469.      IF numinstopts% = 0 THEN
  470.           sz$ = UIStartDlg(CUIDLL$, CDNOCHOICES, "FInfo0DlgProc", 0, "")
  471.           GOTO CUSTINST
  472.      ENDIF
  473.  
  474. QUIT:
  475.     ON ERROR GOTO ERRQUIT
  476.  
  477.     IF ERR = 0 THEN
  478.         dlg% = EXITSUCCESS
  479.     ELSEIF ERR = STFQUIT THEN
  480.         dlg% = EXITQUIT
  481.     ELSE
  482.         dlg% = EXITFAILURE
  483.     END IF
  484. QUITL1:
  485.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  486.     IF sz$ = "REACTIVATE" THEN
  487.         GOTO QUITL1
  488.     END IF
  489.      UIPop 1
  490.  
  491.     END
  492.  
  493. ERRQUIT:
  494.      sz$ = UIStartDlg(CUIDLL$, CORUPTSOURCES, "FInfo0DlgProc", 0, "")
  495.      END
  496.  
  497.  
  498. GETPATH:
  499.     SetSymbolValue "EditTextIn", DEST$
  500.     SetSymbolValue "EditFocus", "END"
  501. GETPATHL1:
  502.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  503.  
  504.     IF sz$ = "CONTINUE" THEN
  505.         olddest$ = DEST$
  506.         DEST$ = GetSymbolValue("EditTextOut")
  507.  
  508.         ''Validate new path.
  509.         IF IsDirWritable(DEST$) = 0 THEN
  510.             GOSUB BADPATH
  511.             GOTO GETPATHL1
  512.         END IF
  513.         UIPop 1
  514.  
  515.         ''Truncate display if too long.
  516.         IF LEN(DEST$) > 23 THEN
  517.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  518.         ELSE
  519.             ReplaceListItem DRIVETEXT$, 7, DEST$
  520.         END IF
  521.  
  522.         ''Recalc if path changed.
  523.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  524.             RecalcPath
  525.             SetDriveStatus
  526.         END IF
  527.  
  528.         olddest$ = ""
  529.         GOTO CUSTINST
  530.     ELSEIF sz$ = "REACTIVATE" THEN
  531.         RecalcPath
  532.         SetDriveStatus
  533.         GOTO GETPATHL1
  534.     ELSEIF sz$ = "EXIT" THEN
  535.         GOSUB ASKQUIT
  536.         GOTO GETPATHL1
  537.     ELSE
  538.         UIPop 1
  539.         GOTO CUSTINST
  540.     END IF
  541.  
  542.  
  543.  
  544. DICTFILES:
  545. DICTL1:
  546.     sz$ = UIStartDlg(CUIDLL$, MULTILISTDICT, "FDictMultiDlgProc", APPHELP, HELPPROC$)
  547.  
  548.     IF sz$ = "CONTINUE" THEN
  549.         UIPop 1
  550.         RecalcOptFiles DICTFILES
  551.         SetDriveStatus
  552.         GOTO CUSTINST
  553.     ELSEIF sz$ = "REACTIVATE" THEN
  554.         RecalcPath
  555.         SetDriveStatus
  556.         GOTO DICTL1
  557.     ELSEIF sz$ = "EXIT" THEN
  558.         GOSUB ASKQUIT
  559.         GOTO DICTL1
  560.     ELSE
  561.         UIPop 1
  562.         GOTO CUSTINST
  563.     END IF
  564.  
  565.  
  566.  
  567. FONTFILES:
  568. FONTL1:
  569.     sz$ = UIStartDlg(CUIDLL$, MULTILISTFONT, "FFontMultiDlgProc", APPHELP, HELPPROC$)
  570.  
  571.     IF sz$ = "CONTINUE" THEN
  572.         UIPop 1
  573.         RecalcOptFiles FONTFILES
  574.         SetDriveStatus
  575.         GOTO CUSTINST
  576.     ELSEIF sz$ = "REACTIVATE" THEN
  577.         RecalcPath
  578.         SetDriveStatus
  579.         GOTO FONTL1
  580.     ELSEIF sz$ = "EXIT" THEN
  581.         GOSUB ASKQUIT
  582.         GOTO FONTL1
  583.     ELSE
  584.         UIPop 1
  585.           GOTO CUSTINST
  586.     END IF
  587.  
  588.  
  589.  
  590. TOOBIG:
  591.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  592.     IF sz$ = "REACTIVATE" THEN
  593.         RecalcPath
  594.         SetDriveStatus
  595.         GOTO TOOBIG
  596.     END IF
  597.     UIPop 1
  598.     RETURN
  599.  
  600.  
  601.  
  602. BADPATH:
  603.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  604.     IF sz$ = "REACTIVATE" THEN
  605.         RecalcPath
  606.         SetDriveStatus
  607.         GOTO BADPATH
  608.     END IF
  609.     UIPop 1
  610.     RETURN
  611.  
  612.  
  613.  
  614. ASKQUIT:
  615.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  616.  
  617.     IF sz$ = "EXIT" THEN
  618.         UIPopAll
  619.         ERROR STFQUIT
  620.     ELSEIF sz$ = "REACTIVATE" THEN
  621.         GOTO ASKQUIT
  622.     ELSE
  623.         UIPop 1
  624.     END IF
  625.      RETURN
  626.  
  627.  
  628.  
  629. '**
  630. '** Purpose:
  631. '**     Adds the specified option files to the copy list.
  632. '** Arguments:
  633. '**     ftype%  - type of files to add, one of the following:
  634. '**             APPFILES, DICTFILES, FONTFILES
  635. '** Returns:
  636. '**     none.
  637. '*************************************************************************
  638. SUB AddOptFilesToCopyList (ftype%) STATIC
  639.  
  640.     ''IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  641.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  642.         IF ftype% = APPFILES THEN
  643.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  644.         ELSEIF ftype% = DICTFILES THEN
  645.             ''dictlen% = GetListLength(DICTLIST$)
  646.             ''FOR i%=1 TO dictlen% STEP 1
  647.             ''    AddSectionKeyFileToCopyList "Dictionaries", GetListItem(DICTLIST$, i%), SrcDir$, DEST$
  648.             ''NEXT i%
  649.             AddSectionFilesToCopyList "Dictionaries", SrcDir$, DEST$
  650.         ELSEIF ftype% = FONTFILES THEN
  651.             ''fontlen% = GetListLength(FONTLIST$)
  652.             ''FOR i%=1 TO fontlen% STEP 1
  653.             ''    AddSectionKeyFileToCopyList "Fonts", GetListItem(FONTLIST$, i%), SrcDir$, DEST$
  654.             ''NEXT i%
  655.             AddSectionFilesToCopyList "Fonts", SrcDir$, DEST$
  656.         END IF
  657.         SrcDir$ = ""
  658.     ''END IF
  659. END SUB
  660.  
  661.  
  662. '**
  663. '** Purpose:
  664. '**     Recalculates disk space for the given option files and sets
  665. '**     the status info symbol "StatusItemsText".
  666. '** Arguments:
  667. '**     ftype% - type of files to add, one of the following:
  668. '**             APPFILES, DICTFILES, FONTFILES
  669. '** Returns:
  670. '**     none.
  671. '*************************************************************************
  672. SUB RecalcOptFiles (ftype%) STATIC
  673.     CursorSave% = ShowWaitCursor()
  674.     ClearCopyList
  675.     AddOptFilesToCopyList ftype%
  676.  
  677.     fExtra% = 0
  678.     IF ftype% = APPFILES THEN
  679.         ListSym$ = APPNEEDS$
  680.         ''IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  681.             ''Add extra cost to Windows drive for ini/progman, etc.
  682.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  683.             ReplaceListItem EXTRACOSTS$, ndrive%, "1"
  684.             fExtra% = 1
  685.         ''END IF
  686.     ELSEIF ftype% = DICTFILES THEN
  687.         ListSym$ = DICTNEEDS$
  688.     ELSEIF ftype% = FONTFILES THEN
  689.         ListSym$ = FONTNEEDS$
  690.     END IF
  691.  
  692.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  693.  
  694.     cost& = 0
  695.     FOR i% = 1 TO 26 STEP 1
  696.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  697.     NEXT i%
  698.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  699.  
  700.     IF StillNeed& > 0 THEN
  701.         ReplaceListItem BIGLIST$, ftype%, "YES"
  702.     ELSE
  703.         ReplaceListItem BIGLIST$, ftype%, ""
  704.     END IF
  705.  
  706.     IF fExtra% THEN
  707.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  708.     END IF
  709.     RestoreCursor CursorSave%
  710.     ListSym$ = ""
  711. END SUB
  712.  
  713.  
  714. '**
  715. '** Purpose:
  716. '**     Recalculates disk space and sets option status info according
  717. '**     to the current destination path.
  718. '** Arguments:
  719. '**     none.
  720. '** Returns:
  721. '**     none.
  722. '*************************************************************************
  723. SUB RecalcPath STATIC
  724.  
  725.     CursorSave% = ShowWaitCursor()
  726.  
  727.     RecalcOptFiles APPFILES
  728.     RecalcOptFiles DICTFILES
  729.     RecalcOptFiles FONTFILES
  730.  
  731.     RestoreCursor CursorSave%
  732. END SUB
  733.  
  734.  
  735. '**
  736. '** Purpose:
  737. '**     Sets drive status info according to latest disk space calcs.
  738. '** Arguments:
  739. '**     none.
  740. '** Returns:
  741. '**     none.
  742. '*************************************************************************
  743. SUB SetDriveStatus STATIC
  744.  
  745.     drive$ = MID$(DEST$, 1, 1)
  746.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  747.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(DICTNEEDS$, ndrive%)) + VAL(GetListItem(FONTNEEDS$, ndrive%))
  748.     free& = GetFreeSpaceForDrive(drive$)
  749.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  750.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  751.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  752.  
  753.     IF drive$ = WINDRIVE$ THEN
  754.         ReplaceListItem DRIVETEXT$, 4, ""
  755.         ReplaceListItem DRIVETEXT$, 5, ""
  756.         ReplaceListItem DRIVETEXT$, 6, ""
  757.     ELSE
  758.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  759.         cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(DICTNEEDS$, ndrive%)) + VAL(GetListItem(FONTNEEDS$, ndrive%))
  760.         IF cost& = 0 THEN
  761.             ReplaceListItem DRIVETEXT$, 4, ""
  762.             ReplaceListItem DRIVETEXT$, 5, ""
  763.             ReplaceListItem DRIVETEXT$, 6, ""
  764.         ELSE
  765.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  766.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  767.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  768.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  769.         END IF
  770.     END IF
  771. END SUB
  772.  
  773.  
  774. '**
  775. '** Purpose:
  776. '**     Appends a file name to the end of a directory path,
  777. '**     inserting a backslash character as needed.
  778. '** Arguments:
  779. '**     szDir$  - full directory path (with optional ending "\")
  780. '**     szFile$ - filename to append to directory
  781. '** Returns:
  782. '**     Resulting fully qualified path name.
  783. '*************************************************************************
  784. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  785.     IF szDir$ = "" THEN
  786.         MakePath = szFile$
  787.     ELSEIF szFile$ = "" THEN
  788.         MakePath = szDir$
  789.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  790.         MakePath = szDir$ + szFile$
  791.     ELSE
  792.         MakePath = szDir$ + "\" + szFile$
  793.     END IF
  794. END FUNCTION
  795.  
  796.  
  797.  
  798. '**
  799. '** Purpose:
  800. '**     Eliminates the path from a filename so that the pure
  801. '**     filename is returned.
  802. '**
  803. '** Arguments:
  804. '**     szFile$ - filename with a path in it
  805. '** Returns:
  806. '**     Pure filename without the path in it.
  807. '*************************************************************************
  808. FUNCTION EliminatePath (szFile$) STATIC AS STRING
  809.  
  810.     iLen% = LEN(szFile$)
  811.     FOR iIndex% = iLen% TO 1 STEP -1
  812.         IF MID$(szFile$,iIndex%,1) = "\" THEN
  813.             EliminatePath = MID$(szFile$,iIndex%+1,iLen%-iIndex%)
  814.          iIndex% = 1
  815.       END IF
  816.     NEXT iIndex%
  817.  
  818. END FUNCTION
  819.  
  820.